#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File  : manage.py
# @Author: Xuhao
# @Date  : 2017/12/4
# @Desc  : 

# from flask_script import Manager, Server
# from app import views
#
#
# manager = Manager(views.app)
#
# manager.add_command("runserver", Server())
#
# @manager.shell
# def make_shell_context():
#     """Create a python CLI.
#
#     return: Default import object
#     type:
#     """
#     # 确保有导入 Flask app object，否则启动的 CLI 上下文中仍然没有 app 对象
#     return dict(app=views.app)
#
#
# if __name__ == "__main__":
#     manager.run() #如果执行调试模式，服务会监听文件改动并自动运行


# import os
#
# if os.path.exists('.env'):
#     print('Importing environment from .env...')
#     for line in open('.env'):
#         var = line.strip().split('=')
#         if len(var) == 2:
#             os.environ[var[0]] = var[1]
#
# from app import views
# from flask_script import Manager, Shell
#
# # 通过配置创建 app
# app = views
#     #views(os.getenv('FLASK_CONFIG') or 'default')
# manager = Manager(app)
#
# def make_shell_context():
#     return dict(app=app)
#
#
# manager.add_command("shell", Shell(make_context=make_shell_context))
#
# @manager.command
# def deploy():
#     """Run deployment tasks."""
#     pass
#
#
# if __name__ == '__main__':
#     manager.run()

from flask_script import Manager
from app.views import app

manager = Manager(app)


if __name__ == '__main__':
    manager.run()